import java.io.*;
import java.net.*;
import java.util.*;

/**
 * This program makes a socket connection to the atomic clock in Boulder, Colorado, and prints the
 * time that the server sends.
 * @version 1.20 2004-08-03
 * @author Cay Horstmann
 */
public class SocketTest
{
   public static void main(String[] args)
   {//201521123113
      try
      {
         Socket s = new Socket("cec.jmu.edu.cn", 80);
         try
         {
            InputStream inStream = s.getInputStream();
            Scanner in = new Scanner(inStream);
            OutputStream out = s.getOutputStream();
            PrintWriter pw = new PrintWriter(out);
        	pw.println("GET /index HTTP/1.0\n");
        	pw.flush();
            while(in.hasNext()){

               String line = in.nextLine();
               System.out.println(line);
               
            }

         }
         finally
         {
            s.close();
         }
      }
      catch (IOException e)
      {
         e.printStackTrace();
      }
   }
}
